<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		 <meta name="viewport" content="width=device-width,initial-scale=1.0">
		<title>新增发票抬头</title>
		<link href="css/index.css" rel="stylesheet" />
	</head>
	<body>
		<script type="text/javascript" src="js/jquery.min.js" ></script>
		<script type="text/javascript" src="js/oldPublic.js" ></script>
		<script type="text/javascript" src="js/code.js" ></script>
		<script type="text/javascript" src="js/security.js"></script>
		<div class="wrapAdd">
		<div class="headTitle">
		<img onclick="goback()" src="./img/leftArrow.jpg" />
		<p>新增发票抬头</p>
       	</div>
       	
		<div class="cahngeType">
			<span  class="spanPerson">个人</span>
			<span  class="spanCompony">企业</span>
			<small></small>
		</div>
		<div class="person" >
			<p class="pHead">
				<small>*</small><span>发票抬头</span><input maxlength="80" placeholder="请填写发票抬头" />
			</p>
			<p class="pMail">
				<small>*</small><span>电子邮箱</span><input placeholder="请填写电子邮箱" />
			</p>
			<p class="pAddress"><span>地址</span><input placeholder="请填写地址,非必填" /></p>
			<p class="pPhone"><span>电话</span><input type="tel" placeholder="请填写电话,非必填" /></p>
			<button class="sure">确定</button>
		</div>
		<div class="compony" style="display: none;">
			<p class="pHead">
				<small>*</small><span>发票抬头</span><input placeholder="请填写发票抬头" />
			</p>
			<p class="pSbh">
				<small>*</small><span>纳税人识别号</span><input placeholder="请填写纳税人识别号" />
			</p>
			<p class="pAddress"><span>地址</span><input placeholder="请填写地址,非必填" /></p>
			<p class="pPhone"><span>电话</span><input placeholder="请填写电话,非必填" /></p>
			<p class="pKhh"><span>开户行</span><input placeholder="填写开户行,非必填" /></p>
			<p class="pZh"><span>账号</span><input placeholder="请填写账号,非必填" /></p>
			<p class="pMail">
				<small>*</small><span>电子邮箱</span><input placeholder="请填写电子邮箱" />
			</p>
			<button class="sure">确定</button>
		</div>
	</div> 
<script>
		var title_type='0';
		var login_name = sessionStorage.getItem('login_name');
		var telphone = sessionStorage.getItem('telphone');
		var orgcode = sessionStorage.getItem('orgcode');
		$('.spanPerson').click(function(){
			title_type = '0';
			$('.person').show();
			$('.compony').hide();
			$('.cahngeType small').addClass('transitionClass1').removeClass('transitionClass2');
		})
		$('.spanCompony').click(function(){
			title_type = '1';
			$('.person').hide();
			$('.compony').show();
			$('.cahngeType small').addClass('transitionClass2').removeClass('transitionClass1');
		})
		
		$('.sure').click(function(){
			var dataInfo = '';
			if(title_type=='0'){
				var name = $('.person .pHead input').val();
				var email = $('.person .pMail input').val();
				var adress = $('.person .pAddress input').val();
				var telphone_no = $('.person .pPhone input').val();
				dataInfo=JSON.stringify({"tag": "9102", 
				'login_name': login_name,
				'telphone': telphone, 
				'bus_type': '2', 
				'title_type': title_type,
				'name': name,
				'email': email, 
				'adress': adress, 
				"telphone_no": telphone_no })
			}else{
				var name = $('.compony .pHead input').val();
				var taxpayer_num = $('.compony .pSbh input').val();
				var email = $('.compony .pMail input').val();
				var adress = $('.compony .pAddress input').val();
				var telphone_no = $('.compony .pPhone input').val();
				var acct_no = $('.compony .pZh input').val();
				var open_bank_name = $('.compony .pKhh input').val();
				dataInfo = JSON.stringify({"tag": "9102", 
				'login_name': login_name,
				'telphone': telphone,
				'bus_type': '2',
				'title_type': title_type,
				'name': name,
				'email': email,
				'adress': adress, 
				"telphone_no": telphone_no,
				'taxpayer_num':taxpayer_num,
				'acct_no':acct_no,
				'open_bank_name':open_bank_name,
				'orgcode':orgcode
				});
			}
			$.ajax({
				type:"post",
				url:sessionStorage.getItem('ipconfig'),
				data:JSON.stringify({data:encryptByDESModeEBC(dataInfo)}),
				contentType: "application/json;charset=utf-8",
				success:function(data){
					if(data.result=='00'){
						showWarn(data.description);
						setTimeout(function(){
							history.back();
						},1000)
					}
				}
			});
		})
</script>

</body>
</html>
